package com.chrray.position.enums.app;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 薪酬计算方式：1-计时,2-计件
 */
public enum FdSalaryCalcMethodEnum implements BaseEnum{
    CALC_TIME(1, "计时"),
    CALC_PIECE(2, "计件")
    ;

    @JsonValue
    @EnumValue
    private final Integer value;
    private final String info;

    FdSalaryCalcMethodEnum(Integer value, String info) {
        this.info = info;
        this.value = value;
    }

    @JsonCreator
    public static FdSalaryCalcMethodEnum getByValue(Integer value) {
        for (FdSalaryCalcMethodEnum en : FdSalaryCalcMethodEnum.values()) {
            if (en.getValue().equals(value)) {
                return en;
            }
        }
        return null;
    }
    @JsonCreator
    public static FdSalaryCalcMethodEnum getByInfo(String info) {
        for (FdSalaryCalcMethodEnum en : FdSalaryCalcMethodEnum.values()) {
            if (en.getInfo().equals(info)) {
                return en;
            }
        }
        return CALC_TIME;
    }


    public Integer getValue() {
        return value;
    }

    public String getInfo() {
        return info;
    }
}
